package com.snowy.hidden.biz.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 审核状态枚举
 * @author hjl
 */
@Getter
@AllArgsConstructor
public enum AuditStatusEnum {
    WAIT_ALLOCATE(0,"待分配核实人"),
    WAIT_VERIFY(1,"待核实"),
    MGR_AUDIT(2,"审核管理员定级"),
    SUPERVISE_AUDIT(3,"监督站站长审核"),
    BIZ_AUDIT(4,"业务部门主任审核"),
    SAFETY_AUDIT(5,"安全部门审核"),
    CHARGE_AUDIT(6,"分管领导审核"),
    MAIN_AUDIT(7,"主要领导审核"),
    FINISHED(8,"完成"),
    UNKNOW(99,"未知"),
    ;

    /**
     * 值
     */
    private Integer value;
    /**
     * 描述
     */
    private String desc;

    public static AuditStatusEnum findByValue(Integer val) {
        return Arrays.stream(AuditStatusEnum.values()).filter(item -> Objects.equals(val, item.getValue())).findFirst().orElse(UNKNOW);
    }

    public static String getNameByValue(Integer val) {
        return Arrays.stream(AuditStatusEnum.values()).filter(item -> Objects.equals(val, item.getValue())).findFirst().orElse(UNKNOW).getDesc();
    }
}
